package com.buddy.webmagic.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static String date2String(Date date) {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");//格式化日期显示方式

        String sdate = sf.format(date);
        return sdate;
    }

    public static String date2TimeString(Date date) {
        if (date == null) return null;
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//格式化日期显示方式

        String sdate = sf.format(date);
        return sdate;
    }
}
